package com.hjm.project.finance.AgentDeductionsKf.service.impl;

import java.util.List;

import com.hjm.common.utils.poi.ExcelUtil;
import com.hjm.project.job.task.service.IJobTaskService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.hjm.project.finance.AgentDeductionsKf.mapper.AgentDeductionsKfMapper;
import com.hjm.project.finance.AgentDeductionsKf.domain.AgentDeductionsKf;
import com.hjm.project.finance.AgentDeductionsKf.service.IAgentDeductionsKfService;
import com.hjm.common.utils.text.Convert;

import javax.annotation.Resource;

/**
 * 代理商还款明细Service业务层处理
 * 
 * @author maker-platform
 * @date 2022-10-26
 */
@Service
public class AgentDeductionsKfServiceImpl implements IAgentDeductionsKfService {
    @Resource
    private AgentDeductionsKfMapper agentDeductionsKfMapper;

    @Resource
    private IJobTaskService jobTaskService;

    /**
     * 查询代理商还款明细
     * 
     * @param id 代理商还款明细ID
     * @return 代理商还款明细
     */
    @Override
    public AgentDeductionsKf selectAgentDeductionsKfById(Integer id) {
        return agentDeductionsKfMapper.selectAgentDeductionsKfById(id);
    }

    /**
     * 查询代理商还款明细列表
     * 
     * @param agentDeductionsKf 代理商还款明细
     * @return 代理商还款明细
     */
    @Override
    public List<AgentDeductionsKf> selectAgentDeductionsKfList(AgentDeductionsKf agentDeductionsKf) {
        return agentDeductionsKfMapper.selectAgentDeductionsKfList(agentDeductionsKf);
    }

    /**
     * 查询代理商还款明细导出
     *
     * @param agentDeductionsKf 代理商还款明细
     * @return 代理商还款明细
     */
    @Async
    @Override
    public Integer export(AgentDeductionsKf agentDeductionsKf, String addMan) {
        List<AgentDeductionsKf> list = agentDeductionsKfMapper.selectAgentDeductionsKfList(agentDeductionsKf);
        ExcelUtil<AgentDeductionsKf> util = new ExcelUtil<AgentDeductionsKf>(AgentDeductionsKf.class);
        jobTaskService.asyncDownLoad("DeductionsKf",Long.parseLong("11"),"代理商扣款明细",addMan,list,util);
        return list.size();
    }

    /**
     * 查询代理商还款明细列表
     *
     * @param agentDeductionsKf 代理商还款明细
     * @return 代理商还款明细 一个结果
     */
    @Override
    public AgentDeductionsKf selectAgentDeductionsKfOne(AgentDeductionsKf agentDeductionsKf) {
        return agentDeductionsKfMapper.selectAgentDeductionsKfOne(agentDeductionsKf);
    }

    /**
     * 新增代理商还款明细
     * 
     * @param agentDeductionsKf 代理商还款明细
     * @return 结果
     */
    @Override
    public int insertAgentDeductionsKf(AgentDeductionsKf agentDeductionsKf) {
        return agentDeductionsKfMapper.insertAgentDeductionsKf(agentDeductionsKf);
    }

    /**
     * 修改代理商还款明细
     * 
     * @param agentDeductionsKf 代理商还款明细
     * @return 结果
     */
    @Override
    public int updateAgentDeductionsKf(AgentDeductionsKf agentDeductionsKf) {
        return agentDeductionsKfMapper.updateAgentDeductionsKf(agentDeductionsKf);
    }

    /**
     * 删除代理商还款明细对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAgentDeductionsKfByIds(String ids) {
        return agentDeductionsKfMapper.deleteAgentDeductionsKfByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除代理商还款明细信息
     * 
     * @param id 代理商还款明细ID
     * @return 结果
     */
    @Override
    public int deleteAgentDeductionsKfById(Integer id) {
        return agentDeductionsKfMapper.deleteAgentDeductionsKfById(id);
    }
}
